﻿Type=Activity
Version=6
ModulesStructureVersion=1
B4A=true
@EndOfDesignText@
#Region  Activity Attributes 
	#FullScreen: False
	#IncludeTitle: True
#End Region

Sub Process_Globals
	'These global variables will be declared once when the application starts.
	'These variables can be accessed from all modules.

End Sub

Sub Globals
	'These global variables will be redeclared each time the activity is created.
	'These variables can only be accessed from this module.

	Private clvchangelog As clsCustomListView
	Private lblmyremain As Label
	Private clvorders As clsCustomListView
	Private mi As myInfo
	Private itemkcname As Label
	Private itempaymethod As Label
	Private itempaymentstatus As Label
	Private itempaydate As Label
	Private itemprice As Label
	Private btnleft As Label
End Sub

Sub Activity_Create(FirstTime As Boolean)
Dim telaw As telanywhere
telaw.Initialize(Activity)

	'Do not forget to load the layout file created with the visual designer. For example:
	Activity.LoadLayout("layaccountremain")
	initviews
End Sub
Sub JobDone(thj As HttpJob)
	If thj.Success Then
		Dim str As String=thj.GetString
		Dim nr As netRes=ParseHelper.getStatusData(str)
		If nr.nCode=200 Then
			parseCaiwu(str)
		Else
			comm.TL("错误:"&nr.sData)
		End If 
	Else
		comm.TL("网络错误:"&thj.ErrorMessage)
	End If
	thj.Release
End Sub
Private Sub parseCaiwu(str As String)
	Dim nh As Int=140dip
	Dim parser As JSONParser 
	parser.Initialize(str) 
	Dim root As Map = parser.NextObject 
	Dim data As Map = root.Get("data") 
	Dim money As String = data.Get("money") 
	Dim cash_count As String = data.Get("cash_count") 
	Dim recharge As String = data.Get("recharge") 
	Dim recharge_count As String = data.Get("recharge_count") 
	Dim cash As String = data.Get("cash") 
	Dim recharge_log As List = data.Get("recharge_log") 
	For Each colrecharge_log As Map In recharge_log 
	    Dim ct_zhanghao As String = colrecharge_log.Get("ct_zhanghao") 
	    Dim note As String = colrecharge_log.Get("note") 
	    Dim ct_type As String = colrecharge_log.Get("ct_type") 
	    Dim title As String = colrecharge_log.Get("title") 
	    Dim is_ok As String = colrecharge_log.Get("is_ok") 
	    Dim Type As String = colrecharge_log.Get("type") 
	    Dim trade_id As String = colrecharge_log.Get("trade_id") 
	    Dim user_type As String = colrecharge_log.Get("user_type") 
	    Dim money As String = colrecharge_log.Get("money") 
	    Dim user_id As String = colrecharge_log.Get("user_id") 
	    Dim api_type As String = colrecharge_log.Get("api_type") 
	    Dim last_time As String = colrecharge_log.Get("last_time") 
	    Dim admin_id As String = colrecharge_log.Get("admin_id") 
	    Dim id As String = colrecharge_log.Get("id") 
	    Dim return_data As String = colrecharge_log.Get("return_data") 
	    Dim add_time As String = colrecharge_log.Get("add_time") 
	    Dim order_sn As String = colrecharge_log.Get("order_sn") 
	    Dim info As String = colrecharge_log.Get("info") 
		Dim cwi As CaiwuItem
		cwi.Initialize
		cwi.title=title
		cwi.apitype=api_type
		cwi.amount=money
		cwi.id=trade_id
		If is_ok.EqualsIgnoreCase("1") Then
			cwi.status="成功"
		Else
			cwi.status="未成功"
		End If
		cwi.time=add_time
		clvchangelog.Add(CreateChangelogItem(cwi,100%x,nh),nh,cwi)
	Next 
	Dim status As String = root.Get("status") 

'
'	For i=0 To 5
'		clvchangelog.Add(CreateChangelogItem(100%x,nh),nh,i)
'	Next
End Sub
Private Sub reqCaiwulst
	ParseHelper.doGetReq(Me,"reqcw",comm.getApi(comm.apiIdx.REQCAIWULST),Null)
End Sub
Sub initviews
	mi=g_store.get("myinfo")
	lblmyremain.Text=mi.yue
	comm.setFA(btnleft,"fa-angle-left","")
	reqCaiwulst
	
	
End Sub
Private Sub CreateChangelogItem (cwi As CaiwuItem,w As Int,h As Int) As Panel
	Dim p As Panel
	p.Initialize("")
	Activity.AddView(p,0,0,w,h)
	p.LoadLayout("itemchangelog")
	p.RemoveView
	itemkcname.Text=cwi.title
	itempaymethod.Text=cwi.apitype
	itempaymentstatus.Text=cwi.status
	itempaydate.Text=cwi.time
	itemprice.Text=""
	comm.setFA(itemprice,"fa-rmb",cwi.amount)
	Return p
End Sub
Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub ivback_Click
	Activity.Finish
End Sub

Sub btncharge_Click
	StartActivity(actCharge)
End Sub

Sub btntixian_Click
	comm.T("未完成")
End Sub